<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <home-page></home-page>
  </div>
  <script src="./vue.js"></script>
  <script>
    // 子组件config
    const CommonHead = {
      template: `
        <div>
          <h3>这是子组件</h3>  
          {{ title }}
          <br/>
          {{ subTitle }}
        </div>
      `,
      // 子组件config定义props属性 接收父组件 中子组件标签 携带自定义属性
      props: ['title', 'subTitle'],
      mounted(){
        console.log(this);
      }
    }
    // 页面
    const Home = {
      template: `
        <div>
          这是home页  
          <hr/>
          <common-head title="这是静态数据" :subTitle="title"></common-head>
        </div>
      `,
      data(){
        return {
          title:"这是父组件的数据"
        }
      },
      components: {
        CommonHead
      }
    }

    Vue.component('HomePage', Home)
    const vm = new Vue({
      el: '#app'
    })
  </script>
</body>
</html>